/**
 * Copyright (C) 2018-2021
 * All rights reserved, Designed By www.yixiang.co

 */
package co.yixiang.modules.user.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import co.yixiang.domain.BaseDomain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

/**
* @author hupeng
* @date 2020-05-12
*/

@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("yx_user_bill")
public class YxUserBill extends BaseDomain {

    /** 用户账单id */
    @TableId
    private Long id;


    /** 用户uid */
    private Long uid;


    /** 关联id */
    private String linkId;


    /** 0 = 支出 1 = 获得 */
    private Integer pm;


    /** 账单标题 */
    private String title;


    /** 明细种类 */
    private String category;


    /** 明细类型 */
    private String type;


    /** 明细数字 */
    private BigDecimal number;


    /** 剩余 */
    private BigDecimal balance;


    /** 备注 */
    private String mark;



    /** 0 = 带确定 1 = 有效 -1 = 无效 */
    private Integer status;

    public static YxUserBillBuilder builder() {
        return new YxUserBillBuilder();
    }


    public void copy(YxUserBill source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }

    public static class YxUserBillBuilder {
        private Long id;
        private Long uid;
        private String linkId;
        private Integer pm;
        private String title;
        private String category;
        private String type;
        private BigDecimal number;
        private BigDecimal balance;
        private String mark;
        private Integer status;

        YxUserBillBuilder() {
        }

        public YxUserBillBuilder id(Long id) {
            this.id = id;
            return this;
        }

        public YxUserBillBuilder uid(Long uid) {
            this.uid = uid;
            return this;
        }

        public YxUserBillBuilder linkId(String linkId) {
            this.linkId = linkId;
            return this;
        }

        public YxUserBillBuilder pm(Integer pm) {
            this.pm = pm;
            return this;
        }

        public YxUserBillBuilder title(String title) {
            this.title = title;
            return this;
        }

        public YxUserBillBuilder category(String category) {
            this.category = category;
            return this;
        }

        public YxUserBillBuilder type(String type) {
            this.type = type;
            return this;
        }

        public YxUserBillBuilder number(BigDecimal number) {
            this.number = number;
            return this;
        }

        public YxUserBillBuilder balance(BigDecimal balance) {
            this.balance = balance;
            return this;
        }

        public YxUserBillBuilder mark(String mark) {
            this.mark = mark;
            return this;
        }

        public YxUserBillBuilder status(Integer status) {
            this.status = status;
            return this;
        }

        public YxUserBill build() {
            return new YxUserBill(id, uid, linkId, pm, title, category, type, number, balance, mark, status);
        }

        public String toString() {
            return "YxUserBill.YxUserBillBuilder(id=" + this.id + ", uid=" + this.uid + ", linkId=" + this.linkId + ", pm=" + this.pm + ", title=" + this.title + ", category=" + this.category + ", type=" + this.type + ", number=" + this.number + ", balance=" + this.balance + ", mark=" + this.mark + ", status=" + this.status + ")";
        }
    }
}
